package org.dizena.common.pojo;

import lombok.Data;

import java.io.Serializable;

@Data
public class PageReq implements Serializable
{
    /**
     * 页码
     */
    private int page = 1;
    /**
     * 页大小
     */
    private int size = 10;
    /**
     * 排序字段
     */
    private String sort;
    /**
     * 排序方向，asc,desc
     */
    private String dire;
    /**
     * 检索字段名
     */
    private String searchField;
    /**
     * 检索内容
     */
    private String searchContent;

    public long getSkip()
    {
        if (this.getPage() < 1)
        {
            this.page = 1;
        }
        return (long) (this.getPage() - 1) * this.getSize();
    }

    public int getLimit()
    {
        return this.getSize();
    }


}
